package serverGUI;

import java.awt.Polygon;

import javax.swing.*;


public class RadarThread extends Thread {
	GUI gui;
	JPanel radarPane;
	RadarCanvas radarCanvas;
	Polygon radar_polygon;


	
	RadarThread(GUI gui, JPanel radarPane) {
		this.gui = gui;
		this.radarPane = radarPane;
		this.radar_polygon = gui.radar_polygon;
		this.radarCanvas = new RadarCanvas(gui, radar_polygon);
		radarPane.add(radarCanvas);
	}
	
	public void run() { 

		while (true) {
			if (!gui.serverRunning) {
				try {
					sleep(100);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			} else {
				radarCanvas.repaint();
				try {
					sleep(100);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		} 
	}
}
